/**
 * @description  : 内管文书中转
 * @descriptionDetail : 内管文书中转
 * @copyright    : 浙江烟草
 * @author       : mc
 * @create       : 2022-11-05 09:50:32
 */
<template>
  <view>    
    <doc-dialog
      v-if="showDialog"
      :docInsUuid="docInsUuid"
      :key="popKey"
      @cancel="docDone"
      @docDone="docDone"
      @close="docDone"
    >
    </doc-dialog>
  </view>
</template>
<script>
import commonService from "@/service/internal/common.service";
import approvalService from "@/service/internal/approval.service.js";
import docDialog from "@/pages/internal/docFrame/docDialog.vue"
import {uuid,} from "@/common/util"
export default {
  components: {docDialog,},
  data() {
    return {
      formData:{
      },
      listData:[],
      checkData:[],
      showDialog: false,
      docInsUuid: "",
      mainInfo: {},
      popKey: uuid(),
      query:{},
    };
  },
  onLoad(opt) {
    this.query = opt;
    
  },
  mounted() {
    approvalService.getSdocById({docInsUuid: this.query.bizUuid,}).then(r => {
      if(r.success) {
        let paras = {
          processId:r.bean.configIns.docCode,
        }
        console.log(paras)
        commonService.searActivity(paras).then((res) => {
          let isStep = res.data.filter(item => {
            return item.activityId == r.bean.step
          });
          if( isStep.length > 0 ) {
            for(let i = 0;i < res.data.length;i++){
              if(res.data[i].activityId == r.bean.step){
                if( res.data[i].isDdTask == 1){
                  this.goDetail(this.query)
                }else{
                  this.$modal.alert("请前往pc端操作", () => {
                    this.showDialog = false;
                    this.backPrev();
                  });
                }
              } else if( r.bean.step == 'view'){
                this.goDetail(this.query)
              } 
            }
          } else {
            //归档环节移动端不做审核审批 fsx start
            this.$modal.alert(`【${r.bean.stepName}】环节,请前往pc端操作。`, () => {
              this.showDialog = false;
              this.backPrev();
            });
            //归档环节移动端不做审核审批 fsx end
          }
        })
      }
    });
    
  },
  methods: {
    docDone() {
      this.showDialog = false;
      this.backPrev();
    },
    goDetail(data) {
      console.log("待办数据", data);
      this.popKey = uuid();
      this.docInsUuid = data.bizUuid;
      console.log("this.docInsUuid", this.docInsUuid);
      this.showDialog = true;
      this.$forceUpdate();
    },
  },
};
</script>
<style lang="scss" scope>
/*展示上拉加载的数据列表*/
.news-li {
  font-size: 32rpx;
  padding: 32rpx;
  border-bottom: 1rpx solid #eee;
}
.news-row {
  width: 100%;
}
.news-logo {
  width: 80rpx;
  height: 80rpx;
  text-align: center;
  // line-height: 80px;
  font-size: 28rpx;
  color: #eee;
  border-radius: 30rpx;
  background: #027aff;
}
.news-title {
  font-size: 24rpx;
  font-weight: 600;
  color: #333333;
}
.news-content-box{
 
}
.news-card{
  display: inline-block;
  padding: 8rpx;
  color: #666680;
  font-size: 24rpx;
  background: #EFF3F9;
  margin-right: 16rpx;
}
</style>